#ifndef _LIST_H_
#define	_LIST_H_

class List {
public:
	List() {
		Init();
	}
	
	void Init() {
		next = prev = this;
	}
	
	bool isEmpty() {
		return next == this && prev == this;
	}
	
	void Add(List *Item) {
		Item->prev->next = Item->next;
		Item->next->prev = Item->prev;
		Item->prev = prev;
		prev->next = Item;
		prev = Item;
		Item->next = this;
	}
	
	void Remove() {
		prev->next = next;
		next->prev = prev;
		next = prev = this;
	}

	struct List *next;
	struct List *prev;
};

#endif
